﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Microsoft.Practices.Repository;
using DotNetCore.BannerManagement.Domain;

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_ClickThroughRepositoryArtifacts
{
    /// <summary>
    /// Construct a dnc_ClickThrough object from a datareader.
    /// </summary>
    internal class GetAllFromdnc_ClickThroughFactory : IDomainObjectFactory<dnc_ClickThrough>
    {
        public dnc_ClickThrough Construct(IDataReader reader)
        {
            dnc_ClickThrough dnc_ClickThrough = new dnc_ClickThrough();

            int advertisementIDIndex = reader.GetOrdinal("AdvertisementID");
            if (!reader.IsDBNull(advertisementIDIndex))
            {
                dnc_ClickThrough.AdvertisementID = reader.GetInt32(advertisementIDIndex);

            }

            int clickThroughIndex = reader.GetOrdinal("ClickThrough");
            if (!reader.IsDBNull(clickThroughIndex))
            {
                dnc_ClickThrough.ClickThrough = reader.GetDateTime(clickThroughIndex);

            }


            return dnc_ClickThrough;
        }
    }
}

